import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const login = r => require.ensure([], () => r(require('@/page/login')), 'login');
const manage = r => require.ensure([], () => r(require('@/page/manage')), 'manage');
const home = r => require.ensure([], () => r(require('@/page/home')), 'home');
const userList = r => require.ensure([], () => r(require('@/page/userList')), 'userList');
const cityList = r => require.ensure([], () => r(require('@/page/cityList')), 'cityList');
const weatherList = r => require.ensure([], () => r(require('@/page/weatherList')), 'weatherList');
const dealList = r => require.ensure([], () => r(require('@/page/dealList')), 'dealList');
const birthdayList = r => require.ensure([], () => r(require('@/page/birthdayList')), 'birthdayList');

const routes = [
	{
		path: '/',
		component: login
	},
	{
		path: '/manage',
		component: manage,
		name: '',
		children: [{
			path: '',
			component: home,
			meta: [],
		},{
			path: '/userList',
			component: userList,
			meta: ['用户管理', '用户信息维护'],
		},{
			path: '/cityList',
			component: cityList,
			meta: ['天气短信数据管理', '地区管理'],
		},{
			path: '/weatherList',
			component: weatherList,
			meta: ['天气数据管理', '天气管理'],
		},{
			path: '/dealList',
			component: dealList,
			meta: ['待办短信数据管理', '待办提醒短信配置'],
		},{
			path: '/birthdayList',
			component: birthdayList,
			meta: ['生日短信数据管理', '生日配置'],
		}]
	}
]

export default new Router({
	routes,
	strict: process.env.NODE_ENV !== 'production',
})
